//
//  HTClassSearchCell.swift
//  QuitSmokingApp
//
//  Created by   on 2024/3/13.
//

import UIKit

class HTClassSearchCell: UITableViewCell {
    lazy var var_containerView: UIView = {
        let var_view = UIView()
        var_view.backgroundColor = .white
        var_view.layer.cornerRadius = 8.auto()
        var_view.layer.borderWidth = 2
        var_view.layer.borderColor = UIColor.white.cgColor
        var_view.backgroundColor = .black
        return var_view
    }()
    lazy var var_nameLabel: UILabel = {
        let var_label = UILabel()
        var_label.textColor = .white
        var_label.font = .systemFont(ofSize: 20, weight: .bold)
        return var_label
    }()
    lazy var var_priceLabel: UILabel = {
        let var_label = UILabel()
        var_label.textColor = UIColor("#00FFF0")
        var_label.font = .systemFont(ofSize: 20, weight: .bold)
        return var_label
    }()
    var var_IsCheak = false {
        didSet {
            if var_IsCheak {
                var_containerView.layer.cornerRadius = 8.auto()
                var_containerView.layer.borderWidth = 2
                var_containerView.layer.borderColor = UIColor("#00FFF0").cgColor
            } else {
                var_containerView.layer.cornerRadius = 8.auto()
                var_containerView.layer.borderWidth = 2
                var_containerView.layer.borderColor = UIColor.white.cgColor
            }
        }
    }
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .none
        self.contentView.backgroundColor = .clear
        self.backgroundColor = .clear
        ht_setUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

    func ht_setUI() {
        self.contentView.addSubview(var_containerView)
        var_containerView.snp.makeConstraints { make in
            make.top.equalToSuperview()
            make.left.equalToSuperview().offset(15)
            make.right.equalToSuperview().offset(-15)
            make.height.equalTo(48)
            make.bottom.equalToSuperview()
        }
        var_containerView.addSubview(var_nameLabel)
        var_nameLabel.snp.makeConstraints { make in
            make.left.equalToSuperview().offset(16)
            make.centerY.equalToSuperview()
        }
        
        
        var_containerView.addSubview(var_priceLabel)
        var_priceLabel.snp.makeConstraints { make in
            make.right.equalToSuperview().offset(-16)
            make.centerY.equalToSuperview()
        }
    }
}
